@model LanLordz.Models.EventDetailsModel
@{
    var controller = this.ViewContext.Controller as LanLordzBaseController;
    ViewBag.Title = Model.Event.Title + " | Event Details";
}
@section headers
{
    <script type="text/javascript">
        $(function() {
            $('.ForumPoll').each(function() {
                var $current = $(this);
                $.post($current.attr('href') + "?partial=1", function(data) {
                    $current.replaceWith('<div class="ForumPoll">' + data + '</div>');
                })
            });
        });
    </script>
}
    <div class="EventsNavigator">@Html.ActionLink(controller.Config.SiteName + " Events", "Index") &gt; @Model.Event.Title</div>
    <div class="EventInfo">
     <h2 class="EventInfoName">@Model.Event.Title</h2>
     <p class="EventInfoInfo">@Html.BBCode(Model.Event.Info)</p>
     <p class="EventInfoStart">Start: @controller.ConvertDateTime(Model.Event.BeginDateTime)</p>
     <p class="EventInfoEnd">End: @controller.ConvertDateTime(Model.Event.EndDateTime)</p>
     <p class="EventInfoSeats">Seats: @Model.Event.Seats</p>
    </div>
    <div class="EventVenue">
     @if (!string.IsNullOrEmpty(controller.Config.GoogleMapsKey))
     {
     <div class="EventVenueMap">
      <img src="http://maps.google.com/staticmap?size=500x300&amp;zoom=15&amp;markers=@(Model.Venue.Longitude),@(Model.Venue.Latitude),blue&amp;key=@(controller.Config.GoogleMapsKey)" alt="@Model.Venue.Address" style="height:300px;width:500px;border-width:0px;" />
     </div>
     }
     <div class="EventVenueLocation">
      <div class="EventVenueLocationName">@Model.Venue.Name</div>
      <div class="EventVenueLocationAddress">@Model.Venue.Address</div>
     </div>
    </div>
    @if (Model.Event.EndDateTime > DateTime.UtcNow && controller.CurrentUser != null)
    {
        if (!Model.Registrants.Where(r => r.UserID == controller.CurrentUser.UserID).Any())
        {
    <div class="EventSignupLink">
    @using (Html.BeginForm("Register", "Events", new { id = Model.Event.EventID }))
    {
      @Html.AntiForgeryToken()
      <input type="submit" value="Register Now!" />
    }
    </div>
        }
    }
    else if (Model.Event.EndDateTime > DateTime.UtcNow && controller.CurrentUser == null)
    {
    <div class="EventSignupLink">
     You are not logged on.  You must @Html.ActionLink("register", "Register", "Account") or log on before you can sign up.
    </div>
    }
    <div class="EventTournaments">
     <div class="EventTournamentsTitle">Tournaments</div>
     <ul class="EventTournamentsList">
     @foreach (var ti in Model.Tournaments)
     {
       <li class="EventTournamentsListTournament">@Html.ActionLink(ti.Title, "ViewTournament", new { id = ti.TournamentID, title = controller.CreateUrlTitle(ti.Title) })</li>
     }
     </ul>
     @if (Model.Event.EndDateTime > DateTime.UtcNow && controller.CurrentUser != null && controller.Security.IsUserAdministrator(controller.CurrentUser))
     {
        @Html.ActionLink("Create Tournament", "CreateTournament")
     }
    </div>
    <div class="EventRoster">
     <div class="EventRosterTitle">Roster</div>
     <div class="EventRosterCount">
        <span>@Model.Registrants.Count()</span> registrations, <span>@Model.Registrants.Where(r => r.Registration.IsCheckedIn).Count()</span> checked in.
     </div>
     <ul class="EventRosterList">
     @foreach (var User in Model.Registrants)
     {
       <li class="EventRosterListUser @(User.Registration.IsCheckedIn ? "EventRosterListUserCheckedIn" : "")">@Html.UserLink(User.UserID, User.Username)</li>
     }
     </ul>
    </div>
    <div class="EventImages">
     <div class="EventImagesTitle">Pictures</div>
     <div class="EventImagesList">
     @{
         var i = 0;
     }
     @foreach (var Image in Model.Images.OrderBy(img => img.EventImageID))
     {
         i++;
      <div class="EventImagesListItem">
       <div class="EventImagesListItemImage"><a href="@Url.Action("ViewImage", "Images", new { id = i, @event = Model.Event.EventID })">@Html.EventImage(Image, 100)</a></div>
      </div>
     }
     </div>
    </div>
